feat: auto-discover wings from root directory on startup#219
Conversation
|
Interesting feature idea, auto-discovering wings would save a lot of manual setup for multi-project users. Some concerns:
|
|
Thanks for the thorough review @adv3nt3 — all great catches. Pushed a fix:
|
web3guru888
left a comment
There was a problem hiding this comment.
✨ Review of #219 — feat: auto-discover wings from root directory on startup
Scope: +298/−4 · 4 file(s) · touches core
mempalace/cli.py(modified: +12/−2)mempalace/config.py(modified: +46/−1)⚠️ mempalace/mcp_server.py(modified: +116/−1)tests/test_auto_discover.py(added: +124/−0)
Technical Analysis
- 🔌 MCP server dispatch changes — verify JSON-RPC compliance and backward compatibility
- 🪟 Windows compatibility — verify path handling works cross-platform
Issues
⚠️ Touchesmempalace/mcp_server.py— Core MCP server — maintainer guards this closely
Strengths
- ✅ Includes test coverage
🟡 Needs attention — touches guarded files and has items to address.
🏛️ Reviewed by MemPalace-AGI · Autonomous research system with perfect memory · Showcase: Truth Palace of Atlantis
…leanup (MemPalace#219) - Remove col.get(metadatas) from _sync_wings_from_root; use wing_config.json only - _folder_to_wing now preserves CJK/Unicode characters via \w regex - Add fallback for empty slug after sanitization - tool_status calls cached _sync_wings_from_root(force=False) - Remove stray blank lines - 4 new tests (CJK, Korean, empty fallback, no-ChromaDB dependency) Made-with: Cursor
|
@web3guru888 Thank you for the review. Addressed all three items in the latest commit:
Tests: 16 passed (test_auto_discover.py), 131 total passed. 2 pre-existing Windows ChromaDB file-lock failures unrelated. |
…leanup (MemPalace#219) - Remove col.get(metadatas) from _sync_wings_from_root; use wing_config.json only - _folder_to_wing now preserves CJK/Unicode characters via \w regex - Add fallback for empty slug after sanitization - tool_status calls cached _sync_wings_from_root(force=False) - Remove stray blank lines - 4 new tests (CJK, Korean, empty fallback, no-ChromaDB dependency) Made-with: Cursor
Use strip('_-') so '--project--' normalizes to wing_project; inner hyphens unchanged.
Made-with: Cursor
…spect Made-with: Cursor
9e0d0d4 to
59e940b
Compare
|
@web3guru888 Thank you for the review. Addressed all three items and rebased onto current develop (post-#852 ChromaBackend refactor).
Tests: 16 passed (test_auto_discover.py), 879 passed total. Rebased cleanly onto develop at b060171 (#852 merge). |
Made-with: Cursor
|
@web3guru888 Thank you for the review. Addressed all three items, rebased onto current develop (post-#852 ChromaBackend refactor), and CI is now fully green.
Tests: 16 passed (test_auto_discover.py), full suite green. CI: 6/6 checks passed. |
Made-with: Cursor
Summary
When users run
mempalace init <dir>, the specified directory is now saved asroot_dirin the config. On each MCP server startup (and onmempalace_statuscalls), subdirectories underroot_dirare automatically scanned and registered as wings.This eliminates the need to manually run
mempalace mine <dir> --wing <name>every time a new project folder is created.Problem
Currently, adding a new wing requires the user to manually run a
minecommand with--wingfor each subdirectory. For users who organize multiple projects under a single parent directory, this is tedious and easy to forget. New projects silently remain invisible to MemPalace until the user remembers to register them.Solution
Three files modified:
config.pyroot_dirproperty — reads from config file orMEMPALACE_ROOT_DIRenv var_save()method — persists config changes to diskinit()— accepts optionalroot_dirparameter and saves itmcp_server.py_sync_wings_from_root()— scansroot_dirsubdirectories, compares against known wings in both ChromaDB metadata andwing_config.json, registers any new folders as wings_folder_to_wing()— normalizes folder names to valid wing namesIGNORE_DIRS— skips common non-project directories (node_modules, .git, pycache, etc.)main()and on eachtool_status()callcli.pycmd_init()— resolves the directory to an absolute path and passes it toconfig.init(root_dir=...)TypeErrorfallback fordetect_rooms_local()which does not acceptyeskwarg in current releaseBehavior
mempalace init ~/projectssaves~/projectsasroot_dirroot_diris not setTesting
Manually verified:
root_diris correctly saved to~/.mempalace/config.jsonIGNORE_DIRSfolders are correctly skipped99/101 tests pass. The 2 failures (
test_convo_mining,test_project_mining) are a pre-existing Windows-specific issue — ChromaDB holds file locks on temp directories duringshutil.rmtreecleanup. Unrelated to this change.Automated tests for the new functionality would be a good follow-up — happy to add them if the approach looks good.
Related
This addresses the general usability concern of manual wing management. No existing issue tracks this specifically — happy to create one if preferred.